//
//  Task_UserRegister.m
//  wmh.ios.v5
//
//  Created by AndLi on 14-9-2.
//  Copyright (c) 2014年 Epoint. All rights reserved.
//

#import "Task_UserRegister.h"
#import "MDUtil.h"
@implementation Task_UserRegister
-(void)execute
{
    
    NSString *url = NSLocalizedString(@"Epoint_DNet_WMH", @"");
    NSString *ValidateData = [EpointBizTools getToken];
    NSString *namespace = NSLocalizedString(@"Epoint_DNet_WMH_NameSpace", @"");
    
    NSString *loginid = [params objectForKey:@"loginid"];
    NSString *name = [params objectForKey:@"name"];
    NSString *phone = [params objectForKey:@"phone"];
    NSString *email = [params objectForKey:@"email"];
    NSString *address = [params objectForKey:@"address"];
    NSString *password = [params objectForKey:@"password"];
    
    
    NSString *method = @"UserRegister";
    NSString *ParasXml = @"<![CDATA[<?xml version=\"1.0\" encoding=\"gb2312\"?><paras><loginid>%@</loginid><name>%@</name><phone>%@</phone><email>%@</email><address>%@</address><password>%@</password></paras>]]>";
    ParasXml = [NSString stringWithFormat:ParasXml,loginid,name,phone,email,address,password];
    
    EpointWebServiceUtil *ws = [[EpointWebServiceUtil alloc]initWithUrl:url namespace:namespace method:method];
    [ws addParameterForString:@"ValidateData" value:ValidateData];
    [ws addParameterForString:@"ParasXml" value:ParasXml];
    NSString *bs =  ws.start;
    
    NSMutableArray *result = [self validateXMLWS2:bs];
    NSString *msg = [result objectAtIndex:1];
    if ([[result objectAtIndex:0]isEqualToString:@"1"]) {
        [self exeSuccessWithData:bs];
    }
    else
    {
        [self exeFailureWithMessage:msg];
    }
    
}

@end
